<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head>
<link rel="stylesheet" type="text/css" href="#{facesContext.externalContext.requestContextPath}/template/css.css" media="all" />
<title>QueroTeto</title>

</h:head>
<h:body>
	<div id="corpo">
		<ui:include src="/template/topo.xhtml"/>
		<ui:include src="/template/menu.xhtml"/>
		
		<div id="conteudo">
			<div id="centro">		
				#{cadastroImovelBean.msg}		
    		<p:panel header="Cadastrar novo imóvel">
				<h:form id="form">  
  

    				
    				
				    <h:panelGrid columns="3" cellpadding="5">
				    	
				   
				      	<h:outputText value="Rua: " />  
            			<p:inputText value="#{cadastroImovelBean.imovel.rua}" required="true" id="rua"/>
            			<p:message for="rua" display="icon" />
            			
            			<h:outputText value="Bairro: " />  
            			<p:inputText value="#{cadastroImovelBean.imovel.bairro}" required="true" id="bairro"/>
            			<p:message for="bairro" display="icon" />
            			
            			<h:outputText value="CEP: " />  
 						<p:inputMask value="#{cadastroImovelBean.imovel.cep}" mask="99999-999" id="cep"/>
            			<p:message for="cep" display="icon" />
            			
            			<h:outputText value="Cidade: " />  
            			<p:inputText value="#{cadastroImovelBean.imovel.cidade}" required="true" id="cidade"/>
            			<p:message for="cidade" display="icon" />
            			
            			<h:outputText value="Estado: " />  
            			<p:inputText value="#{cadastroImovelBean.imovel.estado}" required="true" id="estado"/>
            			<p:message for="estado" display="icon" />
            			
            			<h:outputText value="Número: " />  
            			<p:inputText value="#{cadastroImovelBean.imovel.numero}" required="true" id="numero"/>
            			<p:message for="numero" display="icon" />
            			
            			<h:outputText value="Referência: " />  
            			<p:inputText value="#{cadastroImovelBean.imovel.referencia}" required="true" id="referencia"/>
            			<p:message for="referencia" display="icon" />
            			
            			
            			<h:outputText value="Tipo: "/>  
        				<p:selectOneRadio id="tipo" value="#{cadastroImovelBean.imovel.tipo}">  
            				<f:selectItem itemLabel="Casa" itemValue="Casa" />  
            				<f:selectItem itemLabel="Apartamamento" itemValue="Apartamento" />  
        				</p:selectOneRadio>
            			<p:message for="tipo" display="icon" />
            			
            			
            			<h:outputText value="Quantidade de quartos: " />  
            			<p:inputText value="#{cadastroImovelBean.imovel.qtdQuartos}" required="true" id="qtdQuartos"/>
            			<p:message for="qtdQuartos" display="icon" />
            			
            			<h:outputText value="Quantidade de banheiros: " />  
            			<p:inputText value="#{cadastroImovelBean.imovel.qtdBanheiros}" required="true" id="qtdBanheiros"/>
            			<p:message for="qtdBanheiros" display="icon" />
            			              
            			<h:outputText value="Possui garagem? : "/>  
        				<p:selectOneRadio id="garagem" value="#{cadastroImovelBean.imovel.garagem}">  
            				<f:selectItem itemLabel="Sim" itemValue="true" />  
            				<f:selectItem itemLabel="Não" itemValue="false" />  
        				</p:selectOneRadio>
            			<p:message for="garagem" display="icon" />
            			
            			<h:outputText value="Valor do aluguel: " />  
            			<p:inputText value="#{cadastroImovelBean.imovel.valorAluguel}" required="true" id="valorAluguel"/>
            			<p:message for="valorAluguel" display="icon" />
            			
            			<h:outputText value="Descrição: " />  
            			<p:inputTextarea value="#{cadastroImovelBean.imovel.descricao}" required="true" id="descricao"/>
            			<p:message for="descricao" display="icon" />
            			
  
  			      </h:panelGrid>  
            	<p:commandButton value="Salvar" type="submit" action="#{cadastroImovelBean.cadastrar}" ajax="false"/> 
				<p:commandButton immediate="true"  value="Cancelar" type="submit" action="#{cadastroImovelBean.cancelar}" ajax="false"/>
		</h:form>
	    	</p:panel>  
			</div>	
			
		</div>
		<div id="both" align="center"></div>
		<ui:include src="/template/rodape.xhtml"/>
	</div>
</h:body>
</html>